import React from 'react';
import {
    Button,
    Text,
    View,
    Image,
    StyleSheet,
    Dimensions,
    StatusBar,
    ActivityIndicator,
    FlatList,
    ScrollView,
    RefreshControl,
    Animated,
    TouchableHighlight,
    SectionList, TouchableOpacity,DeviceEventEmitter
} from 'react-native';
//引入
import ScrollableTabView, { DefaultTabBar, ScrollableTabBar } from 'react-native-scrollable-tab-view';
import TXLists from './TXLists';
import TXinfo from './TXinfo';
import app from '../../../app.json';
import Ugame from '../../../Ugame';
import Httpc from "../../utils/Httpc";
import REQUEST from "../../../REQUEST";
import Football from "../../utils/Football";
import Utils from "../../utils/Utils";

import Styles from './Styles';
const { width, height } = Dimensions.get('window')
import RootSiblings from 'react-native-root-siblings';

var id = 0;
var elements = [];
export default class Tianxian extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            tabShow: false,
            label: ['银行卡', '提现记录'],
            single_type:{},
            curr_single_type: { id: 0, data: '所有彩种' },
        };
        this.truename=null;
    }
    static navigationOptions = {
        title: '提现',
        //header: null,  //隐藏顶部导航栏
        //tabBarVisible: false, // 隐藏底部导航栏
        headerStyle: {
            backgroundColor: '#d0162e',
            paddingTop: 18,
        },
        headerTintColor: '#fff',
        headerTitleStyle: {
           
        },
    }
    componentDidMount() {    
        const { navigation } = this.props;
        this.truename = navigation.getParam("truename");
        setTimeout(() => {
            this.setState({
                tabShow: true
            });
        }, 0)
        
    }
    getServerData() {
        let _this = this;
        let params = {};
        params.token = Ugame.info.Token;
        Httpc.get(REQUEST.GetCashInfo, params, function (res) {
            if (res.StatusCode == -2) {
                Ugame.clearInfo();
            }
            if (res.StatusCode == 1) {
                if(res.Data.havePass==0){
                    this.props.navigation.navigate('TixianPass');
                }
            }
        })
    }
 

    renderScrollableTab=()=>{
        let {label,truename} = this.state;    
        if (this.state.tabShow){
            return (
                <ScrollableTabView
                    style={{paddingTop: 8}}
                    renderTabBar={() =>
                        <ScrollableTabBar
                            style={{height:35,borderBottomColor:'#ffffff',borderWidth:1}}
                            tabStyle={{height:35}}
                        />
                    }
                    tabBarBackgroundColor='#fff'
                    tabBarActiveTextColor='#d0162e'
                    tabBarInactiveTextColor='#333'
                    tabBarUnderlineStyle={Styles.tabBarUnderlines}
                >
                    {                        
                        label.map((item, index) => {   
                            if(item=='银行卡'){
                                return <TXinfo navigation={this.props.navigation} truename={this.truename} tabLabel={item} key={++index}/>;
                            }else{
                                return <TXLists navigation={this.props.navigation} truename={this.truename} tabLabel={item} key={++index}/>;
                            }
                        })
                    }
                </ScrollableTabView>
            )
        }
    }

    render() {
        return (
            <View style={Styles.container}>
                {this.renderScrollableTab()}
            </View>
        )
    }
}


